<?php

use yii\helpers\Html;
use common\models\BaseSite;
use common\components\grid\GridView2015;
use common\models\CmsContent;

/* @var $this yii\web\View */
/* @var $searchModel common\models\searchs\SearchCmsContent */
/* @var $dataProvider yii\data\ActiveDataProvider */

$this->title = 'CMS内容管理';
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="cms-content-index">   
    <?= GridView2015::widget([
        'dataProvider' => $dataProvider,
        'filterModel' => $searchModel,
        'title'=>$this->title,
    	'panel' => [
    		'before' =>''
    	],
        'columns' => [
            ['class' => 'common\components\grid\CheckboxColumn2015'],

            'id',
           // 'type_id',
            [
                'class' => 'common\components\grid\DataColumn2015',
                'attribute' => 'type_id',
    		'value'=>function($searchModel){ return CmsContent::getTypeName($searchModel->type_id);},
			
            ],
            [
            'attribute' => 'content',
            'width' => '400px',
            'value' => function($model) {
            	return f_sub($model->content, 100);
            }
            ],

			//'site_id',
			[
			'class' => 'common\components\grid\DataColumn2015',
			'attribute' => 'site_id',
			'filter' =>BaseSite::getCmsSite(),
			'value'=>function($searchModel){ return BaseSite::getCmsSiteName($searchModel->site_id);},
			 
			],

            'create_time:datetime',
           // 'status',
            [
            'class' => 'common\components\grid\DataColumn2015',
            'attribute' => 'status',
            'value'=>function($searchModel){ return CmsContent::getStatus($searchModel->status);},
            	
            ],
                    
            [
			'class' => 'common\components\grid\ActionColumn2015',
                        'template' =>'{view} {update}',
			],

        ],
    ]); ?>

</div>
